// pages/fail/fail.js
var app = getApp();
var user_remote_info_fun = require("../../utils/user_remote_info.js");
Page({
  toShouQuan:function(){
    wx.openSetting({
      success:function(){
        wx.getUserInfo({
          success: function (res) {
              var app = getApp();
              app.globalData.getUserInfoFail = false;
              app.globalData.userInfo["nickname"] = res.userInfo["nickName"];
              app.globalData.userInfo["sex"] = res.userInfo["gender"];
              app.globalData.userInfo["country"] = res.userInfo["country"];
              app.globalData.userInfo["city"] = res.userInfo["city"];
              app.globalData.userInfo["province"] = res.userInfo["province"];
              app.globalData.userInfo["language"] = res.userInfo["language"];
              app.globalData.userInfo["headimgurl"] = res.userInfo["avatarUrl"];
              app.globalData.userInfo["photo"] = res.userInfo["photo"];
              user_remote_info_fun.getRemoteUserInfo();
              wx.switchTab({
                url: '/page/index/index',
              })
          },
          fail: function (res) {
            app.globalData.getUserInfoFail = false;
            wx.showToast({
              title: '您还没授权成功',
              image:"../../image/cancel.png"
            })
          }
        });
      }
    })
  },
})